<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="全部用户" name="first">
        <div style="margin:2% 0;display: inline-block;">
          <span>手机号:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号" v-model="phone">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>昵称:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
            v-model="userName">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>用户来源：</span>
          <el-select v-model="platform" placeholder="请选择来源" style="width:150px;"
            @change="selectTrigger(platform)">
            <el-option v-for="item in platforms" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div style="display: inline-block;">
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询</el-button>
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置</el-button>
        </div>
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
          <el-table-column prop="phone" label="手机号">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates(scope.row)">{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="来源">
          </el-table-column>
          <el-table-column prop="openid" label="是否是普通用户">
            <template slot-scope="scope">
              <span v-if="scope.row.openid!=''">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是骑手用户">
            <template slot-scope="scope">
               <span v-if="scope.row.userType==2 || scope.row.riderOpenId  || scope.row.onLineFlag">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是会员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.isVip==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是商铺管理员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.adminUserId">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="invitationCode" label="邀请码">
      </el-table-column>
      <el-table-column label="邀请人邀请码">
        <template slot-scope="scope">
          <span style="color: #4f9dec;cursor: pointer;"
            @click="updates2(scope.row)">{{scope.row.inviterCode ? scope.row.inviterCode : '未绑定'}}</span>
        </template>
      </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubao ? scope.row.zhifubao : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
          	<template slot-scope="scope">
          		<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
          			暂无图片
          		</div>
          		<div v-if="scope.row.cashQrCode" style="display:flex;flex-wrap: wrap;">
          			<el-popover placement="top-start" title="" trigger="hover">
          				<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
          				<img style="width: 200px; height: 200px" :src="scope.row.cashQrCode" alt="">
          			</el-popover>
          		</div>
          	</template>
          </el-table-column>
          <!-- <el-table-column prop="shopAdminFlag" label="是否是店铺管理员">
            <template slot-scope="scope">
              <span v-if="scope.row.shopAdminFlag==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="vipExpirationTime" label="会员到期时间" width="160">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160">
          </el-table-column>
          <el-table-column prop="status " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :disabled="!isAuth('userList:updateStatus')" :active-value="openValue" :inactive-value="closeValue"
                active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="150">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情
              </el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">删除用户
              </el-button>
              <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateVip')" v-if="scope.row.isVip!=1" @click="updatesVip(scope.row)">赠送会员
              </el-button>
             <!-- <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateStatus')"
                @click="updatesShop(scope.row)">{{scope.row.shopAdminFlag==1?'取消商铺管理员':'设置商铺管理员'}}
              </el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="骑手用户" name="second">
        <div style="margin:2% 0;display: inline-block;">
          <span>手机号:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号" v-model="phone">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>昵称:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
            v-model="userName">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>用户来源：</span>
          <el-select v-model="platform" placeholder="请选择来源" style="width:150px;"
            @change="selectTrigger(platform)">
            <el-option v-for="item in platforms" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div style="display: inline-block;">
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询</el-button>
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置</el-button>
        </div>
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
          <el-table-column prop="phone" label="手机号">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates(scope.row)">{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="来源">
          </el-table-column>
          <el-table-column prop="openid" label="是否是普通用户">
            <template slot-scope="scope">
              <span v-if="scope.row.openid!=''">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是骑手用户">
            <template slot-scope="scope">
               <span v-if="scope.row.userType==2 || scope.row.riderOpenId  || scope.row.onLineFlag">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是会员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.isVip==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是商铺管理员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.adminUserId">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="invitationCode" label="邀请码">
    </el-table-column>
    <el-table-column label="邀请人邀请码">
      <template slot-scope="scope">
        <span style="color: #4f9dec;cursor: pointer;"
          @click="updates2(scope.row)">{{scope.row.inviterCode ? scope.row.inviterCode : '未绑定'}}</span>
      </template>
    </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubao ? scope.row.zhifubao : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
          	<template slot-scope="scope">
          		<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
          			暂无图片
          		</div>
          		<div v-if="scope.row.cashQrCode" style="display:flex;flex-wrap: wrap;">
          			<el-popover placement="top-start" title="" trigger="hover">
          				<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
          				<img style="width: 200px; height: 200px" :src="scope.row.cashQrCode" alt="">
          			</el-popover>
          		</div>
          	</template>
          </el-table-column>
         <!-- <el-table-column prop="shopAdminFlag" label="是否是店铺管理员">
            <template slot-scope="scope">
              <span v-if="scope.row.shopAdminFlag==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="vipExpirationTime" label="会员到期时间" width="160">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160">
          </el-table-column>
          <el-table-column prop="status " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :disabled="!isAuth('userList:updateStatus')" :active-value="openValue" :inactive-value="closeValue"
                active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="150">
            <template slot-scope="scope">

              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情
              </el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">
                删除用户
              </el-button>
              <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateVip')" v-if="scope.row.isVip!=1" @click="updatesVip(scope.row)">赠送会员
              </el-button>
              <!-- <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateStatus')"
                @click="updatesShop(scope.row)">{{scope.row.shopAdminFlag==1?'取消商铺管理员':'设置商铺管理员'}}
              </el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="会员用户" name="thirdVip">
        <div style="margin:2% 0;display: inline-block;">
          <span>手机号:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号" v-model="phone">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>昵称:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
            v-model="userName">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>用户来源：</span>
          <el-select v-model="platform" placeholder="请选择来源" style="width:150px;"
            @change="selectTrigger(platform)">
            <el-option v-for="item in platforms" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div style="display: inline-block;">
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询</el-button>
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置</el-button>
        </div>
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
          <el-table-column prop="phone" label="手机号">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates(scope.row)">{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="来源">
          </el-table-column>
          <el-table-column prop="openid" label="是否是普通用户">
            <template slot-scope="scope">
              <span v-if="scope.row.openid!=''">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是骑手用户">
            <template slot-scope="scope">
              <span v-if="scope.row.userType==2 || scope.row.riderOpenId  || scope.row.onLineFlag">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是会员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.isVip==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是商铺管理员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.adminUserId">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="invitationCode" label="邀请码">
      </el-table-column>
      <el-table-column label="邀请人邀请码">
        <template slot-scope="scope">
          <span style="color: #4f9dec;cursor: pointer;"
            @click="updates2(scope.row)">{{scope.row.inviterCode ? scope.row.inviterCode : '未绑定'}}</span>
        </template>
      </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubao ? scope.row.zhifubao : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
          	<template slot-scope="scope">
          		<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
          			暂无图片
          		</div>
          		<div v-if="scope.row.cashQrCode" style="display:flex;flex-wrap: wrap;">
          			<el-popover placement="top-start" title="" trigger="hover">
          				<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
          				<img style="width: 200px; height: 200px" :src="scope.row.cashQrCode" alt="">
          			</el-popover>
          		</div>
          	</template>
          </el-table-column>
          <!-- <el-table-column prop="shopAdminFlag" label="是否是店铺管理员">
            <template slot-scope="scope">
              <span v-if="scope.row.shopAdminFlag==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="vipExpirationTime" label="会员到期时间" width="160">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160">
          </el-table-column>
          <el-table-column prop="status " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :disabled="!isAuth('userList:updateStatus')" :active-value="openValue" :inactive-value="closeValue"
                active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="150">
            <template slot-scope="scope">

              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情
              </el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">
                删除用户
              </el-button>
              <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateVip')" v-if="scope.row.isVip!=1" @click="updatesVip(scope.row)">赠送会员
              </el-button>
              <!-- <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateStatus')"
                @click="updatesShop(scope.row)">{{scope.row.shopAdminFlag==1?'取消商铺管理员':'设置商铺管理员'}}
              </el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="商铺管理员用户" name="thirdMd">
        <div style="margin:2% 0;display: inline-block;">
          <span>手机号:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号" v-model="phone">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>昵称:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
            v-model="userName">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>用户来源：</span>
          <el-select v-model="platform" placeholder="请选择来源" style="width:150px;"
            @change="selectTrigger(platform)">
            <el-option v-for="item in platforms" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div style="display: inline-block;">
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询</el-button>
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置</el-button>
        </div>
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
          <el-table-column prop="phone" label="手机号">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates(scope.row)">{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="来源">
          </el-table-column>
          <el-table-column prop="openid" label="是否是普通用户">
            <template slot-scope="scope">
              <span v-if="scope.row.openid!=''">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是骑手用户">
            <template slot-scope="scope">
               <span v-if="scope.row.userType==2 || scope.row.riderOpenId  || scope.row.onLineFlag">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是会员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.isVip==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是商铺管理员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.adminUserId">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="invitationCode" label="邀请码">
      </el-table-column>
      <el-table-column label="邀请人邀请码">
        <template slot-scope="scope">
          <span style="color: #4f9dec;cursor: pointer;"
            @click="updates2(scope.row)">{{scope.row.inviterCode ? scope.row.inviterCode : '未绑定'}}</span>
        </template>
      </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubao ? scope.row.zhifubao : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
          	<template slot-scope="scope">
          		<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
          			暂无图片
          		</div>
          		<div v-if="scope.row.cashQrCode" style="display:flex;flex-wrap: wrap;">
          			<el-popover placement="top-start" title="" trigger="hover">
          				<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
          				<img style="width: 200px; height: 200px" :src="scope.row.cashQrCode" alt="">
          			</el-popover>
          		</div>
          	</template>
          </el-table-column>
          <!-- <el-table-column prop="shopAdminFlag" label="是否是店铺管理员">
            <template slot-scope="scope">
              <span v-if="scope.row.shopAdminFlag==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="vipExpirationTime" label="会员到期时间" width="160">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160">
          </el-table-column>
          <el-table-column prop="status " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :disabled="!isAuth('userList:updateStatus')" :active-value="openValue" :inactive-value="closeValue"
                active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="150">
            <template slot-scope="scope">

              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情
              </el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">
                删除用户
              </el-button>
              <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateVip')" v-if="scope.row.isVip!=1" @click="updatesVip(scope.row)">赠送会员
              </el-button>
              <!-- <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateStatus')"
                @click="updatesShop(scope.row)">{{scope.row.shopAdminFlag==1?'取消商铺管理员':'设置商铺管理员'}}
              </el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="普通用户" name="third">
        <div style="margin:2% 0;display: inline-block;">
          <span>手机号:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号" v-model="phone">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>昵称:</span>
          <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
            v-model="userName">
          </el-input>
        </div>
        <div style="margin:2% 0;display: inline-block;">
          <span>用户来源：</span>
          <el-select v-model="platform" placeholder="请选择类型" style="width:150px;"
            @change="selectTrigger(platform)">
            <el-option v-for="item in platforms" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div style="display: inline-block;">
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询</el-button>
          <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置</el-button>
        </div>
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{scope.row.nickName ? scope.row.nickName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
          <el-table-column prop="phone" label="手机号">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates(scope.row)">{{scope.row.phone ? scope.row.phone : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="来源">
          </el-table-column>
          <el-table-column prop="openid" label="是否是普通用户">
            <template slot-scope="scope">
              <span v-if="scope.row.openid!=''">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是骑手用户">
            <template slot-scope="scope">
               <span v-if="scope.row.userType==2 || scope.row.riderOpenId  || scope.row.onLineFlag">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是会员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.isVip==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="isvip" label="是否是商铺管理员用户">
            <template slot-scope="scope">
              <span v-if="scope.row.adminUserId">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="invitationCode" label="邀请码">
      </el-table-column>
      <el-table-column label="邀请人邀请码">
        <template slot-scope="scope">
          <span style="color: #4f9dec;cursor: pointer;"
            @click="updates2(scope.row)">{{scope.row.inviterCode ? scope.row.inviterCode : '未绑定'}}</span>
        </template>
      </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{scope.row.zhifubao ? scope.row.zhifubao : '未绑定'}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
          	<template slot-scope="scope">
          		<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
          			暂无图片
          		</div>
          		<div v-if="scope.row.cashQrCode" style="display:flex;flex-wrap: wrap;">
          			<el-popover placement="top-start" title="" trigger="hover">
          				<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
          				<img style="width: 200px; height: 200px" :src="scope.row.cashQrCode" alt="">
          			</el-popover>
          		</div>
          	</template>
          </el-table-column>
          <!-- <el-table-column prop="shopAdminFlag" label="是否是店铺管理员">
            <template slot-scope="scope">
              <span v-if="scope.row.shopAdminFlag==1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="vipExpirationTime" label="会员到期时间" width="160">
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160">
          </el-table-column>
          <el-table-column prop="status " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :disabled="!isAuth('userList:updateStatus')" :active-value="openValue" :inactive-value="closeValue"
                active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="150">
            <template slot-scope="scope">

              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情
              </el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">
                删除用户
              </el-button>
              <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateVip')" v-if="scope.row.isVip!=1" @click="updatesVip(scope.row)">赠送会员
              </el-button>
              <!-- <el-button size="mini" type="primary" :disabled="!isAuth('userList:updateStatus')"
                @click="updatesShop(scope.row)">{{scope.row.shopAdminFlag==1?'取消商铺管理员':'设置商铺管理员'}}
              </el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30,50,100]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        openValue: 1,
        closeValue: 2,
        state: 'false',
        limit: 10,
        page: 1,
        phone: '',
        userName: '',
        platform: '',
        isRelation: -1,
        isTuan: -1,
        value: '',
        member: -1,
        payData: [],
        nickName: '',
        grade: '',
        name: '',
        activeName: 'first',
        tableDataLoading: true,
        tableData: [],
        platforms: [{
          value: '',
          label: '全部'
        }, {
          value: 'app',
          label: 'app'
        }, {
          value: '小程序',
          label: '小程序'
        }, {
          value: 'h5',
          label: 'h5'
        }],
        shopAdminFlag: '', //是否是店铺管理员 1是 2否
        type: '',
        isVip:'',//是否是会员
      }
    },
    methods: {
      // tabs切换
      handleClick(tab, event) {
        this.page = 1
        this.limit = 10
        this.platform = ''
        if (tab._props.label == '全部用户') {
          this.type = ''
          this.isVip = ''
          this.shopAdminFlag = ''
          this.dataSelect()
        }
        if (tab._props.label == '骑手用户') {
          this.type = 2
          this.isVip = ''
          this.shopAdminFlag = ''
          this.dataSelect()
        }
        if (tab._props.label == '普通用户') {
          this.type = 1
          this.isVip = 0
          this.shopAdminFlag = 0
          this.dataSelect()
        }
        if (tab._props.label == '会员用户') {
          this.type = ''
          this.isVip = 1
          this.shopAdminFlag = ''
          this.dataSelect()
        }
        if (tab._props.label == '商铺管理员用户') {
          this.type = ''
          this.isVip = ''
          this.shopAdminFlag = 1
          this.dataSelect()
        }


      },
      // 状态
      change(val, userId) {
        this.$http({
          url: this.$http.adornUrl(`user/updateUserStatusByUserId?userId=${userId}`),
          method: 'get',
          data: this.$http.adornData({})
        }).then(({
          data
        }) => {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.dataSelect()
            }
          })
        })
      },
      // 详情跳转
      updates(row) {
        this.$router.push({
          path: '/userDetail',
          query: {
            userId: row.userId
          }
        })
      },
      // 赠送会员
      updatesVip(row) {
        this.$confirm('是否设置为会员？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('admin/dataCentre/presenterVip'),
            method: 'post',
            params: this.$http.adornParams({
              'userId': row.userId
            })
          }).then(({
            data
          }) => {
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.dataSelect()
              }
            })
          })
        })
      },
      // 设置商铺管理端
      updatesShop(row) {
        if (row.shopAdminFlag == 1) {
          var texts = '确定取消商铺管理员?'
          var shopAdminFlag1 = 2
        } else {
          var texts = '确定设置商铺管理员?'
          var shopAdminFlag1 = 1
        }
        this.$confirm(texts, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('user/updateShopAdminFlag'),
            method: 'get',
            params: this.$http.adornParams({
              'userId': row.userId,
              'shopAdminFlag': shopAdminFlag1
            })
          }).then(({
            data
          }) => {
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.dataSelect()
              }
            })
          })
        })

      },
      // 详情跳转
      updates2(row) {
        this.$router.push({
          path: '/userDetail',
          query: {
            userId: row.superior
          }
        })
      },
      handleSizeChange(val) {
        this.limit = val
        this.dataSelect()
      },
      handleCurrentChange(val) {
        this.page = val
        this.dataSelect()
      },
      handleSizeChange1(val) {
        this.limit = val
        this.paySelect()
      },
      handleCurrentChange1(val) {
        this.page = val
        this.paySelect()
      },
      // select自动选择
      selectTrigger() {
        this.dataSelect()
      },
      // 查询
      select() {
        this.page = 1
        this.dataSelect()
      },
      select2() {
        this.paySelect()
      },
      // 重置
      cleans() {
        this.page = 1
        this.phone = ''
        this.userName = ''
        this.shopAdminFlag = ''
        this.dataSelect()
      },
      cleans2() {
        this.page = 1
        this.phone = ''
        this.userName = ''
        this.paySelect()
      },
      //删除用户
      deleteuser(row) {
        let delid = row.userId
        this.$confirm(`确定删除此条信息?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl(`user/deleteUserByUserId/${delid}`),
            method: 'post',
            params: this.$http.adornParams({})
          }).then(({
            data
          }) => {
            if (data.code == 0) {
              this.$message({
                message: '删除成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.dataSelect()
                }
              })
            } else {
              this.$message({
                message: data.msg,
                type: 'warning',
                duration: 1500,
                onClose: () => {}
              })
            }

          })
        })
      },
      // 获取数据列表
      dataSelect() {
        this.tableDataLoading = true
        this.$http({
          url: this.$http.adornUrl('user/selectUserList'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.page,
            'limit': this.limit,
            'shopAdminFlag': this.shopAdminFlag,
            'phone': this.phone,
            'nickName': this.userName,
            'type': this.type,
            'isVip':this.isVip,
            'platform':this.platform
          })
        }).then(({
          data
        }) => {
          this.tableDataLoading = false
          let returnData = data.data
          this.tableData = returnData
        })
      }
    },
    mounted() {
      this.dataSelect()
    }
  }
</script>

<style scoped="scoped">
  .el-button+.el-button {
    margin-left: 0 !important;
    margin-top: 5px !important;
  }
</style>
